import os
import folium
import json
import numpy
us_states = os.path.join('data', 'us-states.json')

with open(us_states) as f:
    states = json.load(f)

kw = {'location': [48, -102], 'zoom_start': 3}
from folium import GeoJson

m = folium.Map(tiles=None, **kw)

GeoJson(states).add_to(m)

m.save(os.path.join('results', 'GeoJSONWithoutTitles_0.html'))
import branca

# Create a white image of 4 pixels, and embed it in a url.
white_tile = branca.utilities.image_to_url([[1, 1], [1, 1]])

# Create a map using this url for each tile.
m = folium.Map(tiles=white_tile, attr='white tile', **kw)

GeoJson(states).add_to(m)

m.save(os.path.join('results', 'GeoJSONWithoutTitles_1.html'))

images = [[(-1)**((i+j)//30) for i in range(300)] for j in range(300)]

tiles = branca.utilities.image_to_url(images)

m = folium.Map(tiles=tiles, attr='Just because we can', **kw)

GeoJson(states).add_to(m)

m.save(os.path.join('results', 'GeoJSONWithoutTitles_2.html'))
images = [[(-1)**((i//30+j//30)) for i in range(300)] for j in range(300)]

tiles = branca.utilities.image_to_url(images)

m = folium.Map(tiles=tiles, attr='Just because we can', **kw)

GeoJson(states).add_to(m)

m.save(os.path.join('results', 'GeoJSONWithoutTitles_3.html'))